package com.gongJiao.controller;

import com.gongJiao.entity.Route;
import com.gongJiao.entity.Site;
import com.gongJiao.entity.Type;
import com.gongJiao.service.RouteService;
import com.gongJiao.service.SiteService;
import com.gongJiao.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 视图统一跳转控制器
 * @author Administrator
 */
@Component
@RequestMapping("view")
public class ViewController {
    @Autowired
    RouteService routeService;
    @Autowired
    TypeService typeService;
    @Autowired
    SiteService siteService;
    /**
     * 跳转登录页面
     * @return
     */
    @RequestMapping("goLogin")
    public String goLogin(){
        return "login";
    }

    /**
     * 跳转到首页
     */
    @RequestMapping("goIndex")
    public String goIndex(){
        return "index";
    }

    /**
     * 跳转到后台首页内容首页
     */
    @RequestMapping("goAdminHome")
    public String goAdminHome(){
        return "admin/home";
    }
    /**
     * 后台主页跳转
     * @return
     */
    @RequestMapping("goAdminIndex")
    public String goAdminIndex(){
        return "admin/index";
    }
    /**
     * 后台公交管理页跳转
     * @return
     */
    @RequestMapping("goVehicleList")
    public String goVehicleList(Model model){
        List<Site> siteLists=siteService.getSiteList();
        model.addAttribute("siteLists",siteLists);
        return "admin/vehicleList";
    }
    /**
     * 后台公交管理页新增公交页面跳转
     * @return
     */
    @RequestMapping("goVehicleAdd")
    public String goVehicleAdd(Model model){
        List<Route> routeList=routeService.getRouteList();
        List<Type> typeList=typeService.getTypeList();
        model.addAttribute("routeList",routeList);
        model.addAttribute("typeList",typeList);
        return "admin/vehicleAdd";
    }
    /**
     * 后台公交分类管理页
     * @return
     */
    @RequestMapping("goTypeList")
    public String goTypeList(){
        return "admin/typeList";
    }
    /**
     * 后台分类管理页新增分类页面跳转
     * @return
     */
    @RequestMapping("goTypeAdd")
    public String goTypeAdd(){
        return "admin/typeAdd";
    }
    /**
     * 后台路线管理页
     * @return
     */
    @RequestMapping("goRouteList")
    public String goRouteList(){
        return "admin/routeList";
    }
    /**
     * 后台分类管理页新增分类页面跳转
     * @return
     */
    @RequestMapping("goRouteAdd")
    public String goRouteAdd(){
        return "admin/routeAdd";
    }
    /**
     * 后台站点管理页
     * @return
     */
    @RequestMapping("goSiteList")
    public String goSiteList(){
        return "admin/siteList";
    }
    /**
     * 后台站点管理页新增站点页面跳转
     * @return
     */
    @RequestMapping("goSiteAdd")
    public String goSiteAdd(){
        return "admin/siteAdd";
    }
    /**
     * 后台公告管理页
     * @return
     */
    @RequestMapping("goNoticeList")
    public String goNoticeList(){
        return "admin/noticeList";
    }
    /**
     * 后台公告管理页新增公告页面跳转
     * @return
     */
    @RequestMapping("goNoticeAdd")
    public String goNoticeAdd(){
        return "admin/noticeAdd";
    }
    /**
     * 后台意见管理页
     * @return
     */
    @RequestMapping("goOpinionList")
    public String goOpinionList(){
        return "admin/opinionList";
    }
    /**
     * 后台用户管理页
     * @return
     */
    @RequestMapping("goUserList")
    public String goUserList(){
        return "admin/userList";
    }

}
